<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-27
	描述：菜品溯源
-->
<div class="content-wrapper" style="min-height: 901px;">
	<!-- Content Header (Page header) -->
	<section class="content-header">
		<h1 style="text-align:center">
        	菜品溯源
      </h1>
	</section>

	<!-- Main content -->
	<section class="content">
		<div class="row">
			<div class="col-md-12">
				<div class="box">
					<div class="box-header">
						<div class="col-md-3">
							<select class="form-control select2 select2-hidden-accessible" style="width: 100%;" tabindex="-1" aria-hidden="true" ng-model="postItemSourceData.period_time">
								<option value="0">---请选择餐别---</option>
								<option ng-repeat="p in selectPeriods" value="{{p.id}}">{{p.name}}</option>

							</select>
						</div>
						<div class='col-md-2'>
							<input type="text" class="form-control" id="datepicker" placeholder="请选择日期" readonly="readonly" ng-model="postItemSourceData.date">
						</div>
						<div class='col-md-3'>
							<input type="text" class="form-control" placeholder="用餐用户姓名" ng-model="postItemSourceData.userMessage">
						</div>
						<button class="btn btn-default" ng-click="searchItemSource()">查询</button>
					</div>
					<div class="box-body table-responsive no-padding">
						<table class="table table-hover">
							<tbody>
								<tr>
									<th>菜品名称</th>
									<th>销售数量</th>
									<th>制作档口</th>
									<th>档口主管</th>
									<th>主管手机</th>
									<th>制作厨师</th>
									<th>厨师手机</th>
									<th style="width: 20%;">操作</th>
								</tr>
								<tr ng-repeat = "i in items">
									<td>{{i.item_name}}</td>
									<td>{{i.sale_count}}</td>
									<td>{{i.workshop_name}}</td>
									<td>{{i.workshop_leader_name}}</td>
									<td>{{i.workshop_leader_cellphone}}</td>
									<td>{{i.chef_name}}</td>
									<td>{{i.chef_cellphone}}</td>
									<td>
										<button class="btn btn-primary" ng-click="byUse(i.item_name,i.item_id,i.workshop_name)" ng-if="byWhoEat">用餐</button>
										<button class="btn btn-primary" ng-click="byMaterie(i.item_name,i.item_id,i.workshop_name)">用料</button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
					<div class="box-footer" style="margin-bottom:10px;">

						<div class="dataTables_info col-sm-2" id="example1_info" role="status" aria-live="polite">总条目数：{{totalNums}}</div>
						<div class="col-md-6 col-md-offset-4">
							<ul class="pagination pull-right" style="margin: 0px;">
								<li class="paginate_button previous" id="example1_previous">
									<a ng-click="Previous()">上一页</a>
								</li>
								<li ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}">
									<!-- class=" paginate_button active" -->
									<a ng-click="selectPage(page)">{{page}}</a>
								</li>
								<li class="paginate_button next" id="example1_next">
									<a ng-click="Next()">下一页</a>
								</li>
							</ul>
						</div>

					</div>
				</div>
				<!-- /.box -->
			</div>
		</div>
	</section>
	<!-- /.content -->
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-29
	描述：按餐溯源模态框
-->
<div class="modal fade" id="showByUse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document" style="width: 75%;">
		<div class="modal-content">
			<div class="modal-header">
				
				
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<button class="btn btn-default btn-sm" style="float: right;" ng-click="download('sourceResult','用餐人')">导出</button>
				<h4 class="modal-title" id="myModalLabel">{{sourceName}}用餐人</h4>
				<div class="row">
					<label class="col-sm-3 control-label">食堂名称:{{responseData.canteen_name}}</label>
					<label class="col-sm-3 control-label">就餐日期:{{responseData.datetime | limitTo:19}}</label>
					<label class="col-sm-2 control-label">就餐餐别:{{responseData.period_name}}</label>
					<label class="col-sm-2 control-label">就餐档口:{{responseData.window_name}}</label>
				</div>
			</div>
			<div class="modal-body" style="height: 600px;overflow-y: auto;"> 
				<table class="table table-hover">
							<tbody>
								<tr>
									<td>就餐姓名</td>
									<td>手机号码</td>
									<td>部门名称</td>
									<td>餐卡类型</td>
									<td>消费数量</td>
								</tr>
								<tr ng-repeat = "r in responseData.details">
									<td>{{r.user_name}}</td>
									<td>{{r.cellphone}}</td>
									<td>{{r.department_name}}</td>
									<td>{{r.card_type_name}}</td>
									<td>{{r.count}}</td>
								</tr>
							</tbody>
						</table>
						<table class="table table-hover download" id="sourceResult">
							<tbody>
								<tr>
									<td colspan="3">
										{{sourceName}}用餐人
									</td>
								</tr>
								<tr>
									<td colspan="5">
										食堂名称:{{responseData.canteen_name}}
										就餐日期:{{responseData.datetime}}
										就餐餐别:{{responseData.period_name}}
										就餐档口:{{responseData.window_name}}
									</td>
								</tr>
								<tr>
									<td>就餐姓名</td>
									<td>手机号码</td>
									<td>部门名称</td>
									<td>餐卡类型</td>
									<td>消费数量</td>
								</tr>
								<tr ng-repeat = "r in responseData.details">
									<td>{{r.user_name}}</td>
									<td>{{r.cellphone}}</td>
									<td>{{r.department_name}}</td>
									<td>{{r.card_type_name}}</td>
									<td>{{r.count}}</td>
								</tr>
							</tbody>
						</table>
			</div>
		</div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-07-05
	描述：按用料溯源
-->
<div class="modal fade" id="showByMaterir" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document" style="width: 75%;">
		<div class="modal-content" style="height: 600px;">
			<div class="modal-header">
				
				
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<button class="btn btn-default btn-sm" style="float: right;" ng-click="download('sourceResultM','用料')">导出</button>
				<h4 class="modal-title" id="myModalLabel">{{sourceName}}用料</h4>
				<!--<div class="row">
					<label class="col-sm-3 control-label">食堂名称:{{responseData.canteen_name}}</label>
					<label class="col-sm-3 control-label">就餐日期:{{responseData.datetime}}</label>
					<label class="col-sm-2 control-label">就餐餐别:{{responseData.period_name}}</label>
					<label class="col-sm-2 control-label">就餐档口:{{responseData.window_name}}</label>
				</div>-->
			</div>
			<div class="modal-body" style="max-height: 600px;overflow-y: auto;min-height: 265px;"> 
				<table class="table table-hover">
							<tbody>
								<tr>
									<td>序号</td>
									<td>原料名称</td>
									<td>原料单位</td>
								</tr>
								<tr ng-repeat = "m in responseData track by $index">
									<td>{{$index+1}}</td>
									<td>{{m.material_name}}</td>
									<!--<td>{{m.count}}</td>-->
									<td>{{m.unit_name}}</td>
								</tr>
							</tbody>
						</table>
						<table class="table table-hover download" id="sourceResultM">
							<tbody>
								<tr>
									<td colspan="3">
										{{sourceName}}用料
									</td>
								</tr>
								<!--<tr>
									<td colspan="5">
										食堂名称:{{responseData.canteen_name}}
										就餐日期:{{responseData.datetime}}
										就餐餐别:{{responseData.period_name}}
										就餐档口:{{responseData.window_name}}
									</td>
								</tr>-->
								<tr>
									<td>序号</td>
									<td>原料名称</td>
									<td>原料单位</td>
								</tr>
								<tr ng-repeat = "m in responseData.details track by $index">
									<td>{{$index+1}}</td>
									<td>{{m.material_name}}</td>
									<!--<td>{{m.count}}</td>-->
									<td>{{m.unit_name}}</td>
								</tr>
							</tbody>
						</table>
			</div>
		</div>
	</div>
</div>
